package com.example.node.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.example.node.util.INode;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 
 * </p>
 *
 * @author yangss
 * @since 2023-11-29
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class BladeDept implements INode<BladeDept> {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.ID_WORKER)
    private Long id;

    private String tenantId;

    private Long parentId;

    private String ancestors;

    private Integer deptCategory;

    private String deptName;

    private String fullName;

    private Integer sort;

    private String remark;

    private Integer isDeleted;

    private List<BladeDept> children;

    @Override
    public Boolean getHasChildren() {
        return this.children.size() > 0 ? true : false;
    }
    @Override
    public List<BladeDept> getChildren() {
        if (this.children == null){
            this.children = new ArrayList<>();
        }
        return this.children;
    }

}
